The Ratings Controller (attached to the Gameboard node) exposes all the ratings features available to creators. This allows creators to expose means for user's to rate their game on the board, and also retrieve the average rating for their game based on overall user ratings.

The Gameboard node is always available in your game as long as the SDK has been integrated. In order to access it we just need to find it.

    var gameboard = GetNode("/root/GameboardSDK") as GameboardPlugin;

Once you have the Gameboard node, you can now access the Rating Controller.

We will first need to define a reference to the controller to make it available throughout our script:

    RatingController ratingController;

And we can assign the controller in the Ready method:

    ratingController = gameboard.GetNode("RatingController") as RatingController;

From the ratingController, you can now access the following methods:

This section include the entire code in one single, easy to copy section.

    RatingsController ratingsController;

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        var gameboard = GetNode("/root/GameboardSDK") as GameboardPlugin;

        ratingController = gameboard.GetNode("RatingController") as RatingController;
    }

    void SetRating(string userId)
    {
        // User logged into the board is giving the game a 10 rating
        ratingController.RateGame(10);

        // User with the specified userId is giving the game a 5.5 rating
        ratingController.RateGameForUser(5.5, userId);
    }

    void GetRating(string userId)
    {
        var ratingForBoardUser = ratingController.GetGameRating();
        var ratingForSpecifiedUser = ratingController.GetGameRatingForUser(userId);
    }

    void GetOverallRating()
    {
        var overallRating = ratingController.GetGameAverageRating(); //Returns the current rating average of the game based on all user ratings
    }